/**
 * 
 */
package gui.views;

import gui.LibraryComboBox;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

import application.Application;
import application.GlobalContext;

/**
 * @author Joshua Lockerman
 *
 */
public class AddAxiomaticTransformView extends JFrame {
    
    private final GlobalContext context;
    private final LibraryComboBox librarySelector;
    
    public AddAxiomaticTransformView()
    {
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        
        context = Application.injector.getInstance(GlobalContext.class);
        
        librarySelector = new LibraryComboBox();
        
        getContentPane().setLayout(new BorderLayout());
        
        JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEADING));
        panel.add(librarySelector);
        add(panel, BorderLayout.NORTH);
        
        add(createCreatorPanel(), BorderLayout.CENTER);
        
        add(createButtonPanel(), BorderLayout.SOUTH);
        
        pack();
        setMinimumSize(getSize());
    }
    
    private Component createCreatorPanel()
    {
        JPanel panel = new JPanel();
        // TODO Auto-generated method stub
        return panel;
    }
    
    private JPanel createButtonPanel()
    {
        JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout(new FlowLayout(FlowLayout.TRAILING));
        
        JButton okButton = new JButton();
        okButton.setAction(new AbstractAction("Add") {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                addTransform();
            }
        });
        buttonPanel.add(okButton);
        
        JButton cancelButton = new JButton();
        cancelButton.setAction(new AbstractAction("Cancel") {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                dispose();
            }
        });
        buttonPanel.add(cancelButton);
        return buttonPanel;
    }
    
    private void addTransform()
    {
        //TODO
    }
}
